/*package com.spring.security.web.task;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.spring.security.core.util.ApplicationUtils;
import com.spring.security.core.util.UDate;
import com.spring.security.web.iputil.IpUtil;
import com.spring.sperapc.web.model.Duty;
import com.spring.sperapc.web.service.OaService;

*//**
 * Created by wojunyu on 2015/8/5.
 *//*
//@Component
public class Test {
	
    @Resource
    private OaService oaService;
	
    public void output() throws Exception{

//			List aa=userService.test("");
//			userService.insertTest(new HashMap());
//			throw  new Exception("Error");
    	SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		System.out.println("---定时器"+format.format(RandomTimeUtil.randomDate(UDate.getDate()+" 09:00:00",format.format(new Date())))//UDate.getDate()+" 09:30:00"
					+"----------------");
		//9点到当前时间  随机一个时间
		Date getTime = RandomTimeUtil.randomDate(UDate.getDate()+" 09:00:00",format.format(new Date()));//format.format(new Date())
		Date nowDutyTime = format.parse(UDate.getDate()+" 09:30:00");
		Date nowOutTime = format.parse(UDate.getDate()+" 17:30:00");
		Date getOutTime = RandomTimeUtil.randomDate(format.format(nowOutTime),format.format(new Date()));//UDate.getDate()+" 18:00:00"
		String[] userArr = {"WV00000018"};
		for(String user_id:userArr){
			
			Map<String,String> m = new HashMap<String,String>();
			m.put("user_id", user_id);
			m.put("sign_date", UDate.getDate());
			List<Map<String,Object>> lm = oaService.selectDuty(m);
			if(!ApplicationUtils.isNotNull(lm)||lm.size()==0){//记录不存在,则是签到
				Duty d = new Duty();
				d.setUser_id(user_id);//WV00000018
				d.setSign_in_time(getTime.getTime()/1000+"");
				d.setSign_in_normal(nowDutyTime.getTime()/1000+"");
				d.setSign_out_time("0");
				d.setSign_out_normal(nowOutTime.getTime()/1000+"");
				d.setIp(IpUtil.getRealIp());
				if(nowDutyTime.getTime()>getTime.getTime()){
					d.setDuty_type("1");
				}else{
					d.setDuty_type("2");
				}
				
				d.setOut_type("2");
				d.setData_type("1");
				d.setIn_time_diff((nowDutyTime.getTime()/1000-getTime.getTime()/1000)+"");
				d.setOut_time_diff("0");
				d.setUser_dept("0");
				d.setUser_priv("0");
				d.setDuty_option("0");
				d.setSign_date(UDate.getDate());
				d.setDuty_why("");
				oaService.insertOaDuty(d);
			}else{//记录存在  则是签退
				Map<String,Object> s = lm.get(0);
				if(ApplicationUtils.isNotNull(s.get("duty_id"))){
					Duty d = new Duty();
					d.setDuty_id(ApplicationUtils.Object2String(s.get("duty_id")));
					d.setSign_out_time((getOutTime.getTime()/1000)+"");
					d.setOut_time_diff((getOutTime.getTime()/1000-nowOutTime.getTime()/1000)+"");
					if(getOutTime.getTime()>nowOutTime.getTime()){
						d.setOut_type("1");
					}else{
						d.setOut_type("2");
					}
					oaService.updateDutyByPrimaryKey(d);
				}
			}
		}
		
//     		CustomerContextHolder.setContextType(CustomerContextHolder.SESSION_FACTORY_SQL);
//        System.out.println(CustomerContextHolder.getContextType());
//        List<Map>list=xmglMapper.getResultSQL("select * from UD_TAB");
//
//        CustomerContextHolder.setContextType(CustomerContextHolder.SESSION_FACTORY_Ctais);
//        List<Map>list2=xmglMapper.getResultSQL("select * from ZL_JGXX");
//        System.out.println(list2.size());
//        CustomerContextHolder.setContextType(CustomerContextHolder.SESSION_FACTORY_ORACLE);

    }
}
*/